UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QDPluuUTo4rHnw7hB8pStQVc22DTY3q/cz3KJ7FT85Q=' 
WHERE 
  key_id = 'bdbafcea19e9d188b999bece359123c1d679c3d2b0c64b8d3d7920539cae4e5f' 
  AND (
    token = 'QDPluuUTo4rHnw7hB8pStQVc22DTY3q/cz3KJ7FT85Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036