UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MaydhHoJ5pX88E2malL9htqdQtfSjGLBZpSYhptRyfU='
WHERE
key_id = '8f356a8c74903653ddda29d233e0b47bad9d18a4c8ab04bd434e1206245895d1'
AND (
token = 'MaydhHoJ5pX88E2malL9htqdQtfSjGLBZpSYhptRyfU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)