UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gi8vLEHKzSYjf1Kpe2n2JTCMHgCR4EnG0H+gqZ21Ybs=' 
WHERE 
  key_id = 'f220b49a52895ef525c07ad9631a5d56258e6d6752538b6e7c8901b2c746642c' 
  AND (
    token = 'gi8vLEHKzSYjf1Kpe2n2JTCMHgCR4EnG0H+gqZ21Ybs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055