UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/vgwkB6msxyBtuTagv6/8ZbiqqXd337rjKrH7tB6y48=' 
WHERE 
  key_id = '1592f07544bd2cb217e1006cb9aa01b029034b39361cefd63107c17568e875ba' 
  AND (
    token = '/vgwkB6msxyBtuTagv6/8ZbiqqXd337rjKrH7tB6y48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016