UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'coYFlWwIbbs3tvF/PpmNaxaLhlSJpbTcuJVzNSpGQMY='
WHERE
key_id = '3b1037de8917d4b2a54393afcb119028a2a4bf8da3c643e578331c016330a0cb'
AND (
token = 'coYFlWwIbbs3tvF/PpmNaxaLhlSJpbTcuJVzNSpGQMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)