UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dr+iXQFtb5hk2C7xV5+c3v1ry3PmOgjbYSlQyW0rJ4o=' 
WHERE 
  key_id = 'f9d048b22de21dce7717f5c0f188ee602137593296245e17f4ce904dd4345965' 
  AND (
    token = 'Dr+iXQFtb5hk2C7xV5+c3v1ry3PmOgjbYSlQyW0rJ4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059