UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/xZLEv7q6OwxEEM/F++qrZQr5KGFSug88qar/XZ0hw=' 
WHERE 
  key_id = '8c61e693d06bd7dbdcde65790ac67f557f1e4b098776c821ddff33614403f4b8' 
  AND (
    token = 'I/xZLEv7q6OwxEEM/F++qrZQr5KGFSug88qar/XZ0hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029