UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qPEh2vtnVCVxoMT/2gM1U0zy/3SKkCEl4ALXtafGuh4=' 
WHERE 
  key_id = '3b15f49cdb3cb7447ca8d19c027e6f9b0862b6f23ee12af430cd9c367c97be1b' 
  AND (
    token = 'qPEh2vtnVCVxoMT/2gM1U0zy/3SKkCEl4ALXtafGuh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037