UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hDf1sLeotxe5aXsmfM3alu4isRVlRGO3jHRxLAXrC2E='
WHERE
key_id = '1767a2051be5052a997c0cb02f3f5da3105ad394f3453db52a96d7369dfb4def'
AND (
token = 'hDf1sLeotxe5aXsmfM3alu4isRVlRGO3jHRxLAXrC2E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)