UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GbP8FpyvefintVzOJFNcoBQAwNLjzUIyIJS06lCsHoc=' 
WHERE 
  key_id = 'c6ec6f1d66e5bf5ae2b493766df180316a4f631bbfb4f7d1568af16de9a8ca33' 
  AND (
    token = 'GbP8FpyvefintVzOJFNcoBQAwNLjzUIyIJS06lCsHoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035