UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AgYaOrXYByOyMm80AuBFzrJ4lrIH3VFsiOOk3DxLr98='
WHERE
key_id = '32cfaeeefd7c97c3c919c59564a89bdba20a174ddff5a31d5cfbab648a96b44f'
AND (
token = 'AgYaOrXYByOyMm80AuBFzrJ4lrIH3VFsiOOk3DxLr98='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)