UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8SO79by4anDEjX6sfqjCPsMy7R0SWiCNiwO7GtkjVd8=' 
WHERE 
  key_id = '4fe284b3a62c16ada33cf7d560ef8642360cf65f2d965088bad479ec39903021' 
  AND (
    token = '8SO79by4anDEjX6sfqjCPsMy7R0SWiCNiwO7GtkjVd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017