UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z8j1FcUDz+8toHazP+nAqjAQo2eNbKQ9++pG/jZ+ObE='
WHERE
key_id = '51f3361089546e94524b6615a2b126bb136c0578c0f03041a4b12c15360cbc2e'
AND (
token = 'z8j1FcUDz+8toHazP+nAqjAQo2eNbKQ9++pG/jZ+ObE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)