UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PmZY/ca7ot8+q73noGJid1Yktt1LiUezo1erC2fCids=' 
WHERE 
  key_id = 'b79135c321011b350c419b2df5151036fd835d47c77db6c65e4adf9db5b9d75e' 
  AND (
    token = 'PmZY/ca7ot8+q73noGJid1Yktt1LiUezo1erC2fCids=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042