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

Query time 0.00033