UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q0vS3pZmK6gAsZ5oRQQVfLVXlNaJspVPAceI1tGW6qw=' 
WHERE 
  key_id = '28679b8cd41090a7855be6615c87641332ad82b2744138d2a67519a4561c31a8' 
  AND (
    token = 'q0vS3pZmK6gAsZ5oRQQVfLVXlNaJspVPAceI1tGW6qw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017