UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ye7kjzbQIQlHBFki/sgVstW2YtLZY3pbGUGvTvOsT0I=' 
WHERE 
  key_id = '21c4b7636942291233b12d528bdbb39a87f0fa0c5057e9b31f4d19b8becaa3b7' 
  AND (
    token = 'Ye7kjzbQIQlHBFki/sgVstW2YtLZY3pbGUGvTvOsT0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036