UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EFqFmRuDzysFE8x2fs2OzxOmedCYReyoJaeIv/jGaQA=' 
WHERE 
  key_id = 'c0aff04b124aedc03999f696baf975aaf38ec4e66e97e60fe8077305e964eae6' 
  AND (
    token = 'EFqFmRuDzysFE8x2fs2OzxOmedCYReyoJaeIv/jGaQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039