UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UiVmMVguvc0M4TlhPtUXtyVkBjhYnJ0rvu0PfaN5KUE=' 
WHERE 
  key_id = 'a283b5479e47944c101d635e5222e4d6307698c2857d1c3b967930295610e2f1' 
  AND (
    token = 'UiVmMVguvc0M4TlhPtUXtyVkBjhYnJ0rvu0PfaN5KUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034