UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TV/5DhHTcR+4bjvwMQfDIyai10Bjop2hjdYLyV88W4o='
WHERE
key_id = 'ed4d74c2f7064c78bba21993545d69c47f3fa25631d7e08348a363367d63dafd'
AND (
token = 'TV/5DhHTcR+4bjvwMQfDIyai10Bjop2hjdYLyV88W4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)