UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6hwS8pW/2+xsCV/Uvi1kTd4myDm2767Bx81QKS0Uiiw='
WHERE
key_id = '6414697743c92c517409874344b4a7909ed3988955bb660fe90625aab4ce1554'
AND (
token = '6hwS8pW/2+xsCV/Uvi1kTd4myDm2767Bx81QKS0Uiiw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)