UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jnEaeEXsz84cIggRNVooXA5TZp6uGvWj463zx3lZLmk='
WHERE
key_id = 'f38ee79566c089e3ee97e798e4c8cbc69eb6cbf1c1381a1ba7662ebfee716e04'
AND (
token = 'jnEaeEXsz84cIggRNVooXA5TZp6uGvWj463zx3lZLmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)