UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+q6oAXSETDhFICeA5/Op+BpGairmbnMrMd2eHRavY4=' 
WHERE 
  key_id = '7e3381f8de2651340275925a425543d2345419578bc0417621c44647da78df1d' 
  AND (
    token = 'C+q6oAXSETDhFICeA5/Op+BpGairmbnMrMd2eHRavY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029