UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UdZ6oC+5A3TJRsj9QcLvknM/qAgA0MBjNeKosPvVNNA=' 
WHERE 
  key_id = '93ef2f885cb891c556c61379abbd1b7eb4e34e04c728e3c09f4fcc13d0661154' 
  AND (
    token = 'UdZ6oC+5A3TJRsj9QcLvknM/qAgA0MBjNeKosPvVNNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032