UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cr41NeKStXfbXuaAUdmn3sVUAxAw+12y6JOAUWLSJis='
WHERE
key_id = '567b49c208ec597dc701a7cf5d5111227b3f52f4d05fe9d62fbfeff3bb4f63a6'
AND (
token = 'Cr41NeKStXfbXuaAUdmn3sVUAxAw+12y6JOAUWLSJis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)