UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '52RIQA/Mh9ouJg95qOKKvq/pHlYtcSTvrNQ8Jva5aIw='
WHERE
key_id = 'c1903db48fe8441e4ae7d9afd8f63218c440d380056f58df378cff81cf701379'
AND (
token = '52RIQA/Mh9ouJg95qOKKvq/pHlYtcSTvrNQ8Jva5aIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)