UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ar++b0QVyzJuCCZ1jKzqsr4Is0+Lud94aI+A8TIveN8='
WHERE
key_id = '164cd2f4cc87092a9f561d8f53a08866022c107bab6408f22d4a37b6cdada1f9'
AND (
token = 'ar++b0QVyzJuCCZ1jKzqsr4Is0+Lud94aI+A8TIveN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)