UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DTS+a85ySuQbGuzJmTqUENku21tvW63sV6JpB736YnA=' 
WHERE 
  key_id = '5b1c12711d309b675425f1334099524433057adf81d130f1a7fd376a92f7a9c2' 
  AND (
    token = 'DTS+a85ySuQbGuzJmTqUENku21tvW63sV6JpB736YnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015