UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MoneKYsDINI7jLitM1WGiA1yT+IvKH6nl0AjClfAFRE=' 
WHERE 
  key_id = '11929239d19d928d4161726b214d20a45c7aa9879d3e0f1a3745f54de07d3878' 
  AND (
    token = 'MoneKYsDINI7jLitM1WGiA1yT+IvKH6nl0AjClfAFRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037