UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8Ea5h4EgAFLdAr7Oo0o+KioKurS/Y8qwALksSuCBc4='
WHERE
key_id = '71ef0965306c61547c05e7abc0240d527e42786c8f9fc8a14b8ac921aab7ea50'
AND (
token = 'S8Ea5h4EgAFLdAr7Oo0o+KioKurS/Y8qwALksSuCBc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)