UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NKq6Hl0ldnVgjnrbyavTcy3ExslgzaRyyaOI7zkza5Y='
WHERE
key_id = '2d5f178597355eda2dd64c7b303f621d7991c3aa200c20dbe99eba2fddaac245'
AND (
token = 'NKq6Hl0ldnVgjnrbyavTcy3ExslgzaRyyaOI7zkza5Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)