UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IAc8K1kSgL58u/YwVp35L/JzEiH7mi3m67BnfCjyPfE=' 
WHERE 
  key_id = '58cd15199f78785047bad74c21e02804d705b6c6610e78b52a241484e3ed1706' 
  AND (
    token = 'IAc8K1kSgL58u/YwVp35L/JzEiH7mi3m67BnfCjyPfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027