UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EA/qYP0GqKZhgyqwGD0aGmFIGuPsG8k2rvGX8+GUp1Y=' 
WHERE 
  key_id = '4625ca53555baa98056743f844a6d529400104738695bb5988a403113657f574' 
  AND (
    token = 'EA/qYP0GqKZhgyqwGD0aGmFIGuPsG8k2rvGX8+GUp1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036