UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pVJhjDjiBjS2HgRQNA/ZfZUhOoeW/TgtFfQ0zvkD+3U='
WHERE
key_id = 'a1af8e13dd8c0179a6082a5213409c10a164f71135f13d82b529ef738dedcd55'
AND (
token = 'pVJhjDjiBjS2HgRQNA/ZfZUhOoeW/TgtFfQ0zvkD+3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)