UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9arv2xcSM7odIW3OQeyyrcTBzwpPTbGHIIdeleJo1o=' 
WHERE 
  key_id = '04fb1697f98ba1b3fc32d25a8e316673944d00cfb8a1d0552ad73891a2e8ed78' 
  AND (
    token = 'd9arv2xcSM7odIW3OQeyyrcTBzwpPTbGHIIdeleJo1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036