UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P2I3ddnEGE3+oXtxY1hZNAV2Q23Sd0VLLyHaTIRWmO4='
WHERE
key_id = 'f1dea90b6cad689bd27c1ec391abd13873e212286d3fc491d007a2bfd0a284a8'
AND (
token = 'P2I3ddnEGE3+oXtxY1hZNAV2Q23Sd0VLLyHaTIRWmO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)