UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EF7tXXIpUNpwXB4dTHkKzakgn3i5XGTdkrfdgnL7xe0=' 
WHERE 
  key_id = '132c6c871385f5787231477a394689e0c61008e12b9a8a0c5d417d340e8d3452' 
  AND (
    token = 'EF7tXXIpUNpwXB4dTHkKzakgn3i5XGTdkrfdgnL7xe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031