UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hc05f2jE+CK29SN/ErQFIzQKM2/TaXIQw5VgG5o27sM=' 
WHERE 
  key_id = 'fa1fb66e7c5ccaca2ac043e2656f30023eceedc9520855c0ae68c81283a8d817' 
  AND (
    token = 'hc05f2jE+CK29SN/ErQFIzQKM2/TaXIQw5VgG5o27sM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026