UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQjB0qmylN9Vz4P1UI/XKm5Q7M5dKVBWrnvr8hJJwXw=' 
WHERE 
  key_id = '7b6046bd35601b6ad80b88082d914590e29f10008a62514daa13236bd8ceef62' 
  AND (
    token = 'BQjB0qmylN9Vz4P1UI/XKm5Q7M5dKVBWrnvr8hJJwXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044