UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gw5L2L5kebP+GX7z8x059wMaZpix44aIRRj8bprRAhY='
WHERE
key_id = 'a313cab6bd812bb34fe48898e47f040649d0b0604a7155f2f251697008f654c6'
AND (
token = 'Gw5L2L5kebP+GX7z8x059wMaZpix44aIRRj8bprRAhY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)